
<?php

$conn = new mysqli();
$conn->connect('127.0.0.1','root','root','bank');

$key = $_COOKIE["userkey"];
session_start();
$ac_id = $_SESSION[$key]['accountId'];
$userName = '';

$userRealName = '';
$result = $conn->query('select * from accountinfo where AccountId = '.$ac_id);

$row = $result->fetch_assoc();

$userRealName = $row['RealName'];

$is_login = false;
if(!isset($_SESSION[$key]["username"])){
    $userName= "你尚未登入，<a href='/login.php'>请登入</a>";
}else{
    $userName =  "欢迎你  ".$userRealName;
    $is_login = true;
}


//
$logUrl =  '../public/image/'.$_GET['log'];

?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<p><?php echo $userName;?><a href="logout.php">退出</a></p>
        <?php if($is_login) {?>
            <a href="changePassword_page.php"><button type="button">修改密码</button></a>
            <p>头像：<img src="<?php echo $logUrl;?>" ></p>

            <form action="img.php" method="post" enctype="multipart/form-data">
                <input type="file" name="file">
                <br/>
                <button type="submit">上传头像</button>
            </form>
        <?php } ?>
	</body>

</html>
